package park.gz.com.parkingfee.bean;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017-03-17.
 */

public class CarInfo {
    private String pass_no;
    private String car_no;//车号
    private String card_type;//车辆类型
    private String in_time;//入场时间
    private String in_image;//入场图片名称
    private String in_door;//入场通道
    private String out_time;//出场时间
    private String parked_time;//停车时长
    private String sum_fee;//应收金额
    private String prepay_id;//预交费ID，调用确认缴费是要用
    private String sum_pre_fee;//已缴费金额
    private String fact_pre_fee;//本次应缴费金额
    private String wx_qrcode;//微信支付二维码（需要转换成图片）

    public String getCard_type() {
        return card_type;
    }

    public void setCard_type(String card_type) {
        this.card_type = card_type;
    }

    public String getWx_qrcode() {
        return wx_qrcode;
    }

    public void setWx_qrcode(String wx_qrcode) {
        this.wx_qrcode = wx_qrcode;
    }

    public String getPass_no() {
        return pass_no;
    }

    public void setPass_no(String pass_no) {
        this.pass_no = pass_no;
    }

    public String getCar_no() {
        return car_no;
    }

    public void setCar_no(String car_no) {
        this.car_no = car_no;
    }

    public String getIn_time() {
        return in_time;
    }

    public void setIn_time(String in_time) {
        this.in_time = in_time;
    }

    public String getIn_image() {
        return in_image;
    }

    public void setIn_image(String in_image) {
        this.in_image = in_image;
    }

    public String getIn_door() {
        return in_door;
    }

    public void setIn_door(String in_door) {
        this.in_door = in_door;
    }

    public String getOut_time() {
        return out_time;
    }

    public void setOut_time(String out_time) {
        this.out_time = out_time;
    }

    public String getParked_time() {
        return parked_time;
    }

    public void setParked_time(String parked_time) {
        this.parked_time = parked_time;
    }

    public String getSum_fee() {
        return sum_fee;
    }

    public void setSum_fee(String sum_fee) {
        this.sum_fee = sum_fee;
    }

    public String getFact_pre_fee() {
        return fact_pre_fee;
    }

    public void setFact_pre_fee(String fact_pre_fee) {
        this.fact_pre_fee = fact_pre_fee;
    }

    public String getSum_pre_fee() {
        return sum_pre_fee;
    }

    public void setSum_pre_fee(String sum_pre_fee) {
        this.sum_pre_fee = sum_pre_fee;
    }

    public String getPrepay_id() {
        return prepay_id;
    }

    public void setPrepay_id(String prepay_id) {
        this.prepay_id = prepay_id;
    }

    public static List<CarInfo> parse(JSONArray jsonArray) throws JSONException{
        List<CarInfo> carInfos = new ArrayList<CarInfo>();
        for (int i = 0;i<jsonArray.length();i++){
            JSONObject jsonObject = new JSONObject(jsonArray.get(i).toString());
            CarInfo carInfo = new CarInfo();
            carInfo.pass_no = jsonObject.getString("pass_no");
            carInfo.car_no = jsonObject.getString("car_no");
            carInfo.card_type = jsonObject.getString("card_type");
            carInfo.in_time = jsonObject.getString("in_time");
            carInfo.in_image = jsonObject.getString("in_image");
            carInfo.in_door = jsonObject.getString("in_door");
            carInfo.out_time = jsonObject.getString("out_time");
            carInfo.parked_time = jsonObject.getString("parked_time");
            carInfo.sum_fee = jsonObject.getString("sum_fee");
            carInfo.sum_pre_fee = jsonObject.getString("sum_pre_fee");
            carInfo.fact_pre_fee = jsonObject.getString("fact_pre_fee");
            carInfo.prepay_id = jsonObject.getString("prepay_id");
            carInfo.wx_qrcode = jsonObject.getString("wx_qrcode");
            carInfos.add(carInfo);
        }
        return carInfos;
    }
}
